package com.cheng.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

/**
 * @author: ChengJW
 * @date: 2022/1/3 20:25
 * @version: 1.0
 * @description:
 */
@Controller
public class TestController extends BaseController{

    @RequestMapping("/test")
    @ResponseBody
    public Date getDate(Date date){
        System.out.println("日期：" + date);
        return date;
    }

    @ResponseBody
    @RequestMapping("/test1")
    public String getStr(String str){
        String t = "^[0-9]{18}$";
        if (str.matches(t)){
            return str + "--" + str.length();
        }else {
            return "wrong"  + "--" + str.length();
        }
    }
}
